//author:jxx
//此处是对表单的方法，组件，权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)
let extension = {
  components: {//动态扩充组件或组件路径
    //表单header、content、footer对应位置扩充的组件
    gridHeader: '',//{ template: "<div>扩展组xx件</div>" },
    gridBody: () => import('./verify/open1.vue'),//编辑
    gridFooter: () => import('./verify/open2.vue'),//房型详情
    //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
    modelHeader: '',
    modelBody: '',
    modelFooter: ''
  },
  buttons: { view: [], box: [], detail: [] },//扩展的按钮
  methods: {//事件扩展
    onInit () {
      this.maxBtnLength = 5;
      this.columns.push({
        title: "操作", width: 300, align: "center", render: (h, { row, column, index }) => {
          return h(
            "div",
            { style: {} },
            [h(
              "Button",
              {
                style: { "margin-right": "10px" },
                on: {
                  click: (e) => {
                    console.log("详情", row);
                    this.$refs.gridFooter.open(row)
                  }
                }
              },
              "详情"
            ),
            h(
              "Button",
              {
                on: {
                  click: (e) => {
                    console.log("编辑", e);
                    this.$refs.gridBody.open(row)
                  }
                }
              },
              "审核"
            ),
            ]
          )
        }
      })
    },
    rowClick ({ row, column, event }) { //查询界面table点击行选中当前行
      //console.log(row,column,event);
      this.$refs.table.$refs.table.toggleRowSelection(row);
      return true;
    },
    // 回传数据
    jsEvent (item) {
      this.$refs.detail.rowData[item.elementIdex] = { ... this.$refs.detail.rowData[item.elementIdex], ...item }
      console.log("房型详情回传数据", this.$refs.detail.rowData[item.elementIdex]);
      this.$refs.gridFooter.close()
    },
    jsEvents (item) {
      // this.$refs.detail.rowData[item.elementIdex].room_Name = item.room_Name
      // this.$refs.detail.rowData[item.elementIdex].room_Code = item.room_Code
      // this.$refs.detail.rowData[item.elementIdex].pms_Room_Code = item.pms_Room_Code
      // this.$refs.detail.rowData[item.elementIdex].real_Quantity = item.real_Quantity
      // console.log("编辑回传数据", this.$refs.detail.rowData[item.elementIdex]);
      let mainData = { mainData: item }
      //mainData.push(item)
      this.http
        .post("api/Mall_work/update", mainData)
        .then((res) => {
          this.http
            .post("api/Mall_work/GetPageDataCheck", { "page": 1, "rows": 30, "sort": "id", "order": "desc", "wheres": "[]" })
            .then((res) => {
              console.log('数据', this.$refs)
              this.$router.go(0)
              this.$refs.gridBody.close()

            });
        });

    },
  }
};
export default extension;

